package com.atguigu.yygh.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.model.hosp.Hospital;
import com.atguigu.yygh.service.IHospitalService;
import com.atguigu.yygh.vo.hosp.HospitalQueryVo;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author kabuda
 * @create 2023-03-04 17:45
 */
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalApiController {
    @Resource
    private IHospitalService hospitalService;

    @GetMapping("findHospitalList/{page}/{limit}")
    public Result findHospitalList(@PathVariable("page")Integer page, @PathVariable("limit")Integer limit, HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageList = hospitalService.list(page, limit, hospitalQueryVo);
        return Result.ok(pageList);
    }
    @GetMapping("findByHosName/{hosname}")
    public Result findByHosName(@PathVariable("hosname")String hosname){
        List<Hospital> list=hospitalService.findByHosName(hosname);
        return Result.ok(list);
    }

}
